﻿//创建时间: 2010-10-11
//创建作者: 李 城
//功能说明: 内容模型 字段管理
//最后修改: 2010-10-11
//最后修改: 2010-10-21 李晓忠 添加 ModelFieldInfoWithTableName
//最后修改: 2010-11-11 李晓忠 添加 IsTitleField、IsMainField、FieldListDisplay 
using System;
using System.Collections.Generic;
using System.Text;

using TRPOP.Common;

namespace TRPOP.CMS.Model
{

    [Serializable]
    public class ModelFieldInfo :  ICloneable
    {
        public virtual object Clone()
        {
            //return this as object;      //引用同一个对象
            return this.MemberwiseClone(); //浅复制
            //return new DrawBase() as object;//深复制
        }


        #region 私有变量
        private int m_intModelFieldId = 0;
        private int m_intFormInputTypeId = 0;
        private int m_intFormInputLimitTypeId = 0;
        private int m_intFormInputValueTypeId = 0;
        private int m_intModelId = 0;
        private string m_strName = "";
        private string m_strFieldName = "";
        private string m_strFieldTypeStr = "";
        private int m_intFieldLength = 0;
        private string m_strDefaultValue = "";
        private int m_intDisplayOrder = 0;
        private bool m_blnIsContribute = false;
        private bool m_blnIsSearch = false;
        private bool m_blnIsCollect = false;
        private bool m_blnIsEdit = false;
        private bool m_blnIsTitleField = false;
        private bool m_blnIsMainField = false;
        private bool m_blnFieldListDisplay = false;
        private string m_strFieldInputPicker = "";
        #endregion

        #region 成员函数

        /// <summary>
        ///  字段id
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int ModelFieldId
        {
            get
            {
                return m_intModelFieldId;
            }
            set
            {
                m_intModelFieldId = value;
            }
        }

        /// <summary>
        ///  录入类型id
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int FormInputTypeId
        {
            get
            {
                return m_intFormInputTypeId;
            }
            set
            {
                m_intFormInputTypeId = value;
            }
        }

        /// <summary>
        ///  限制类型ID
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int FormInputLimitTypeId
        {
            get
            {
                return m_intFormInputLimitTypeId;
            }
            set
            {
                m_intFormInputLimitTypeId = value;
            }
        }

        /// <summary>
        ///  录入可选值类型id
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int FormInputValueTypeId
        {
            get
            {
                return m_intFormInputValueTypeId;
            }
            set
            {
                m_intFormInputValueTypeId = value;
            }
        }

        /// <summary>
        ///  所属模型id
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int ModelId
        {
            get
            {
                return m_intModelId;
            }
            set
            {
                m_intModelId = value;
            }
        }

        /// <summary>
        ///  名称
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public string Name
        {
            get
            {
                return m_strName;
            }
            set
            {
                m_strName = value;
            }
        }

        /// <summary>
        ///  表字段名
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public string FieldName
        {
            get
            {
                return m_strFieldName;
            }
            set
            {
                m_strFieldName = value;
            }
        }

        /// <summary>
        ///  表字段类型
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public string FieldTypeStr
        {
            get
            {
                return m_strFieldTypeStr;
            }
            set
            {
                m_strFieldTypeStr = value;
            }
        }

        /// <summary>
        ///  表字段长度
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int FieldLength
        {
            get
            {
                return m_intFieldLength;
            }
            set
            {
                m_intFieldLength = value;
            }
        }

        /// <summary>
        ///  表字段默认值
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public string DefaultValue
        {
            get
            {
                return m_strDefaultValue;
            }
            set
            {
                m_strDefaultValue = value;
            }
        }

        /// <summary>
        ///  字段排序
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public int DisplayOrder
        {
            get
            {
                return m_intDisplayOrder;
            }
            set
            {
                m_intDisplayOrder = value;
            }
        }

        /// <summary>
        ///  是否允许投稿
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool IsContribute
        {
            get
            {
                return m_blnIsContribute;
            }
            set
            {
                m_blnIsContribute = value;
            }
        }

        /// <summary>
        ///  是否允许搜索
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool IsSearch
        {
            get
            {
                return m_blnIsSearch;
            }
            set
            {
                m_blnIsSearch = value;
            }
        }

        /// <summary>
        ///  是否允许采集
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool IsCollect
        {
            get
            {
                return m_blnIsCollect;
            }
            set
            {
                m_blnIsCollect = value;
            }
        }

        /// <summary>
        ///  是否可编辑
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool IsEdit
        {
            get
            {
                return m_blnIsEdit;
            }
            set
            {
                m_blnIsEdit = value;
            }
        }

        /// <summary>
        ///  是否标题字段
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool IsTitleField
        {
            get
            {
                return m_blnIsTitleField;
            }
            set
            {
                m_blnIsTitleField = value;
            }
        }

        /// <summary>
        ///  是否主内容
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool IsMainField
        {
            get
            {
                return m_blnIsMainField;
            }
            set
            {
                m_blnIsMainField = value;
            }
        }

        /// <summary>
        ///  是否列表显示
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public bool FieldListDisplay
        {
            get
            {
                return m_blnFieldListDisplay;
            }
            set
            {
                m_blnFieldListDisplay = value;
            }
        }

        /// <summary>
        ///  
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public string FieldInputPicker
        {
            get
            {
                return m_strFieldInputPicker;
            }
            set
            {
                m_strFieldInputPicker = value;
            }
        }

        #endregion

    }


    [Serializable]
    public class ModelFieldInfoWithTableName : ModelFieldInfo, ICloneable
    {
        public override  object Clone()
        {
            return this.MemberwiseClone()  ; //浅复制
        }

        #region 私有变量
        private string m_strTableName = "";
        #endregion

        #region 成员函数

        /// <summary>
        ///  表名
        /// </summary>
        [DataAttribute(FieldType.DBField)]
        public string TableName
        {
            get
            {
                return m_strTableName;
            }
            set
            {
                m_strTableName = value;
            }
        }
        #endregion

    }
}

